package com.antball.aaa.obsever_mediator;



import java.util.Observable;

/**
 * @Auther: huangsj
 * @Date: 2019/8/8 11:07
 * @Description:
 */
public class ControlEvent extends Observable {

    private Control source;

    private EventType eventType;

    public ControlEvent(Control control){
        this.source =control;
    }


    public ControlEvent(Control control,EventType eventType){
        this.source =control;
        this.eventType = eventType;
    }

    public EventType getEventType() {
        return eventType;
    }

    public void setEventType(EventType eventType) {
        this.eventType = eventType;
    }

    public Control getSource() {
        return source;
    }

    public void happen(){
        super.addObserver(EventDispatch.getEventDispatch());
        super.setChanged();
        super.notifyObservers(source);

    }

}
